package com.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.bean.ChannelBean;
import com.project.bean.PostBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;

@Mapper
public interface IPostMapper extends BaseMapper<PostBean> {
    /**
     * 按频道id，分页动态条件查询所有主贴
     * @param pg
     * @param id
     * @param name
     * @param startDate
     * @param endDate
     * @return 分页对象{主题、作者、回帖数量，发送时间 }
     */
    IPage<PostBean> cutByItem(Page pg, @Param("id") Integer id,
                              @Param("name") String name,
                              @Param("title") String title,
                              @Param("startDate") LocalDate startDate,
                              @Param("endDate") LocalDate endDate);
    PostBean findById(Integer id);
}
